<template>
<!-- 服务商资金异动明细 -->
  <div>
    <FilterTable
      ref="table"
      :columns="columns"
      :fetchapi="fetchApi"
      :params="fetchParams"
      :datakey="'records'"
      :onColumnsChange="columns => this.columns = columns"
      :isSelectColumn="false"
      :isExportExcel2="true"
      :exportFileName="'备件盘点单明细.xlsx'"
    >

    </FilterTable>
    <div style="height:47px;"></div>
    <div
      :style="{
        position: 'absolute',
        left: 0,
        bottom: 0,
        right: 0,
        zIndex: 9,
        borderTop: '1px solid #e9e9e9',
        padding: '10px 20px',
        background: '#fff',
        textAlign: 'right'
      }"
    >
      <el-button @click="closeDrawer(1)">关 闭</el-button>
    </div>
  </div>
</template>
<script>

import {findInventoryAuditDetail} from '@/api/partsmanage/inventory/stockInventoryAudit/index';
import { dictionary } from '@/utils/dictMixin';
export default {
  props: {
    params: {
      type: Object,
      required: true,
      default: () => {}
    },
  },
  data(){
    return{
      columns:this.createdTable(),
      fetchParams:{},
      fetchApi:findInventoryAuditDetail
    }
  },
  mixins:[dictionary],
  created(){
    console.log(this.params);
    this.fetchParams = Object.assign({},this.fetchParams,{inventoryId:this.params.id})
  },
  methods:{
    closeDrawer(val){
      this.$emit('close')
    },
    createdTable(){
      return [
        {
          title: '序号',
          dataIndex: 'index',
          width: 80,
          sorter: true,
          align:"center",
          render: props => {
            return <span>{props.row.index + 1}</span>;
          }
        },
        {
          title: '仓库',
          dataIndex: 'warehouse',
          sorter: true,
          filter: true,
          filterType: 'input',
          align:"center",
        },
        {
          title: '库位',
          dataIndex: 'place',
          sorter: true,
          filter: true,
          filterType: 'input',
          align:"center",
        },
        {
          title: '备件代码',
          dataIndex: 'partCode',
          sorter: true,
          filter: true,
          filterType: 'input',
          align:"center",
        },
        {
          title: '备件名称',
          dataIndex: 'partName',
          sorter: true,
          filter: true,
          filterType: 'input',
          align:"center",
        },
        {
          title: '备件来源',
          dataIndex: 'partSource',
          align:"center",
          sorter: true,
          filter: true,
          filterType: 'input',
        },
        {
          title: '账面库存',
          dataIndex: 'stock',
          align:"center",
          sorter: true,
          precision: 2,
          numberFormat: true
        },
        {
          title: '清点数量',
          dataIndex: 'checkNum',
          align:"center",
          sorter: true,
          precision: 2,
          numberFormat: true
        },
        {
          title: '差异数量',
          dataIndex: 'differenceNum',
          align:"center",
          sorter: true,
          precision: 2,
          numberFormat: true
        },
        // {
        //   title: '成本单价',
        //   align:"center",
        //   dataIndex: 'costPrice',
        //   sorter: true,
        //   precision: 2,
        //   numberFormat: true
        // },
        {
          title: '含税成本价',
          dataIndex: 'taxCostPrice',
          align:"center",
          sorter: true,
          precision: 2,
          numberFormat: true
        },
        {
          title: '库存金额',
          dataIndex: 'stockPrice',
          align:"center",
          sorter: true,
          precision: 2,
          numberFormat: true
        }
      ]
    },
  },

}
</script>
